﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace BestBuy.UserControls
{
    public partial class MessagePanel : System.Web.UI.UserControl
    {
        public enum MessageType
        {
            Warning,
            Success,
            Info,
            Error,
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.IsPostBack)
            {
                MessageContainer.Visible = false;
            }
        }

        public void Show(string message, MessageType type)
        {
            MessageLabel.Text = message;
            switch (type)
            {
                case MessageType.Warning:
                    MessageContainer.CssClass = "message-panel alert";
                    break;
                case MessageType.Success:
                    MessageContainer.CssClass = "message-panel alert alert-success";
                    break;
                case MessageType.Info:
                    MessageContainer.CssClass = "message-panel alert alert-info";
                    break;
                case MessageType.Error:
                    MessageContainer.CssClass = "message-panel alert alert-error";
                    break;
            }

            MessageContainer.Visible = true;
        }
    }

}